package com.lemon.smartsafetynew.ui.adapter.ledger;

import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.view.View;
import android.widget.TextView;

import com.lemon.smartsafety.R;
import com.lemon.smartsafetynew.entity.patrol.SafePatrolCheckItemVo;
import com.lemon.smartsafetynew.util.common.CommonUtil;

import java.util.List;

import butterknife.Bind;
import butterknife.ButterKnife;
import kale.adapter.LemonRcvAdapter;
import kale.adapter.item.AdapterItem;

/**
 * Created by Andrew on 2017/10/31.
 */

public class LedgerCheckItemListAdapter extends LemonRcvAdapter<SafePatrolCheckItemVo> {

    public LedgerCheckItemListAdapter(@Nullable List<SafePatrolCheckItemVo> data) {
        super(data);
    }

    @NonNull
    @Override
    public AdapterItem createItem(Object type) {
        return new LedgerCheckItem();
    }

    public class LedgerCheckItem implements AdapterItem<SafePatrolCheckItemVo> {

        @Bind(R.id.check_item_title_tv)
        TextView checkItemTitleTv;

        @Override
        public int getLayoutResId() {
            return R.layout.item_check_item_child_item;
        }

        @Override
        public void bindViews(View root) {
            ButterKnife.bind(this, root);
        }

        @Override
        public void setViews() {

        }

        @Override
        public void handleData(SafePatrolCheckItemVo safePatrolCheckItemVo, int position) {

            checkItemTitleTv.setText(CommonUtil.avoidNullString(safePatrolCheckItemVo.getCheck_way()));

        }
    }
}
